#include "main.h"
#include "common_utils.h"
#include "bsp_timer.h"
#include "bsp_led.h"
#include "bsp_rtc.h"
#include "bsp_sdhi.h"
#include "lvgl_task.h"
#include "codec_task.h"
#include "save_task.h"


static uint32_t g_mainTick;

rtc_time_t now;

/**
 * 函数功能：主任务初始化
 */
void Main_Init(void)
{
     SDHI_RW_Test();

    //SDRAMReadWrite32Bit_test();

    lvgl_task_init();

    codec_task_init();

    save_task_init();
}

/**
 * 函数功能：主任务
 */
void Main_Task(void)
{
    lvgl_task();

    Led_Task();

    codec_task();

    save_task();

    if(GetSysTick()-g_mainTick>1000)
    {
        rtc_get_time(&now);
        APP_PRINT("RTC: %04d-%02d-%02d %02d:%02d:%02d\r\n",
               now.tm_year + 1900,
               now.tm_mon + 1,
               now.tm_mday,
               now.tm_hour,
               now.tm_min,
               now.tm_sec);
        g_mainTick=GetSysTick();
    }
}
